package com.comum.javahomework420242025.repository;

import com.comum.javahomework420242025.pojo.AllFile;
import com.comum.javahomework420242025.pojo.Production;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ProductionRepository extends JpaRepository<Production, Long> {
    @Query(value = "select * from production where type=:type and (name like %:str% or " +
            "weight like %:str% or model like %:str% or size like %:str% or " +
            "cycle like %:str% or comment like %:str%)",nativeQuery = true)
    Page<Production> selectByStr(String str,String type, Pageable pageable);

    List<Production> findAllByType(String type);
}